home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / AmigaSystem / Scalos / StackWindow_plugin / StackWindows.e next >
Text File  |  2002-10-28  |  2KB  |  83 lines

  1. OPT PREPROCESS
  2.  
  3.  
  4. LIBRARY 'stackwindows.plugin',1,0,'$VER: stackwindows.plugin 1.0 (11.08.2001)' IS stackWindows(A0,A1)
  5.  
  6. MODULE 'scalos/scalos','intuition/intuition','intuition/intuitionbase','intuition/screens','amigaini','libraries/amigainibase'
  7.  
  8.  
  9. PROC stackWindows(wt:PTR TO scaWindowTask,i:PTR TO scaIconNode)
  10. DEF w=0:PTR TO window,x=0,y=15,xi=15,yi=15,
  11. ib:PTR TO intuitionbase,mx,my,ai=0:PTR TO amigaini
  12.  
  13. /* Check for amigaini lib and load attempt to load settings */
  14.  
  15.  IF (amigainibase:=OpenLibrary(AMIGAININAME,AMIGAINI_VMIN))<>NIL
  16.  ai:=InitINI('ENV:Scalos/StackWindows.ini')
  17.  ai:=ReadINI(ai)
  18.    IF ai.error=0
  19.    FindGroupINI(ai,'INITIAL')
  20.    x:=GetIntINI(x,ai,'LEFT',0)
  21.    y:=GetIntINI(y,ai,'TOP',15)
  22.    FindGroupINI(ai,'INCREMENT')
  23.    xi:=GetIntINI(xi,ai,'MOVE RIGHT',15)
  24.    yi:=GetIntINI(yi,ai,'MOVE DOWN',15)
  25.    FreeINI(ai)
  26.    ENDIF
  27.  CloseLibrary(amigainibase)
  28.  ai:=0
  29.  ENDIF
  30.  
  31. /* get a pointer to intuitionbase */
  32. ib:=intuitionbase
  33.  
  34. Forbid()  -> forbid acces while we mess around
  35.  
  36. /* get screen size */
  37. mx:=ib.activescreen::screen.width
  38. my:=ib.activescreen::screen.height
  39.  
  40. /* get apointer to the passed window structure */
  41. w:=wt.window
  42.  
  43. /* see if multiple windows are open and cycle back to the first one */
  44. IF w.parent THEN WHILE w.parent DO w:=w.parent
  45.  
  46. /* Now cycle through the window list in the right order */
  47. w:=w.descendant
  48. WHILE w.descendant<>NIL
  49.  
  50.  IF StrLen(w.title)<>0  -> window has title text
  51.  stack(w,x,y,mx,my)     -> Stack the window
  52.  x:=x+xi
  53.  y:=y+yi
  54.  ENDIF
  55.  
  56. IF w.descendant THEN w:=w.descendant
  57. ENDWHILE
  58.  
  59. Permit()
  60.  
  61. ENDPROC
  62.  
  63. PROC stack(w:PTR TO window,x,y,mx,my); DEF dx,dy,dw=0,dh=0
  64. dx:=(0-w.leftedge)+x
  65. dy:=(0-w.topedge)+y
  66.  
  67. IF (w.width+x) > mx
  68. dw:=mx-(w.width+x)
  69. ENDIF
  70. IF (w.height+y) > my
  71. dh:=my-(w.height+y)
  72. ENDIF
  73.  
  74. IF (dw) OR (dh) THEN SizeWindow(w,dw,dh)
  75.  
  76.  MoveWindow(w,dx,dy)
  77.  WindowToFront(w)
  78.  ActivateWindow(w)
  79. ENDPROC
  80.  
  81.  
  82. PROC main() IS EMPTY
  83.